package flatlandAgent;

import evolutionaryProblems.Phenotype;
import gui.GUIFrame;
import gui.GameModel;

public class FlatlandGameModel extends GameModel<RunFlatlandPhenotype>{
	
//	private RunFlatlandPhenotype runPhenotype;
	private FlatlandParameters parameters; 
	
	public FlatlandGameModel(GUIFrame guiFrame, FlatlandParameters parameters){
		super(guiFrame);
		this.parameters = parameters; 
		initPhenotypeList(); 
	}

	@Override
	protected void runPhenotype(Phenotype phenotype) {
		reset(); 
		runPhenotype = new RunFlatlandPhenotype(this, (FlatlandPhenotype) phenotype); 
		new Thread(runPhenotype).start();
		
	}

	@Override
	public int getIterationsPerMap() {
		return parameters.getIterationsPerMap();
	}
	
//	public void reset(){
//		if (runPhenotype == null) {
//			return; 
//		}
//		runPhenotype.kill(); 
//		while (!runPhenotype.haveKilled()) {
//			try {
//				Thread.sleep(20);
//			} catch (InterruptedException e) {
//				e.printStackTrace();
//			}
//		}
//	}
//
//	@Override
//	public void pauseSimulation() {
//		if (runPhenotype == null) {
//			return; 
//		}
//		runPhenotype.pause(true);
//	}
//
//	@Override
//	public void continueSimulation() {
//		if (runPhenotype == null) {
//			return; 
//		}
//		runPhenotype.pause(false);
//	}
//	

}
